package com.gewe.wxChat.model.enums;

import com.google.common.collect.Lists;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum OrderYaoYueStatusEnum {

    //邀约;-10-审验中;-1-免邀约;0-未邀约;10-邀约中;20-邀约成功

    ShenYanZhong(-10, "审验中"),
    MianYaoYue(-1, "免邀约"),
    WeiCaoZuo(0, "未进行网货发起"),
    JuQian(7, "拒签"),
    YaoYueZhong(10, "邀约中"),
    YaoYueChengGong(20, "邀约成功");

    private int code;
    private String desc;

    OrderYaoYueStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDesc(int code) {
        for (OrderYaoYueStatusEnum item : OrderYaoYueStatusEnum.values()) {
            if (item.getCode() == code) {
                return item.getDesc();
            }
        }
        return "";
    }

    /**
     * 枚举遍历为list
     * @return
     */
    public static List<Map<String, Object>> getEnumToList() {
        List<Map<String, Object>> list = Lists.newArrayList();
        for (OrderYaoYueStatusEnum item : OrderYaoYueStatusEnum.values()) {
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("code", item.getCode());
            map.put("value", item.getDesc());
            list.add(map);
        }
        return list;
    }
}
